//
//  IsLanTabCell.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/3/2.
//  Copyright © 2016年 game. All rights reserved.
//

#import "IsLanTabCell.h"
#import "UIImageView+WebCache.h"
#import "TQStarRatingView.h"
#import "LoginController.h"
#define Cellheight (SCREEN_HEIGHT*0.14)

@interface IsLanTabCell ()
/**
 *  距离lab
 */
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *distansLab;
/**
 *  图片
 */
@property (weak, nonatomic) IBOutlet UIImageView *MainImage;

/**
 *  图片宽
 */
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imgWith;

/**
 * 标题
 */
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *title;
/**
 *  地点
 */
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *areaLab;

/**
 *  描述  价格等
 */
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *describLab;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *linHight;


@property (nonatomic,strong) TQStarRatingView *starRating;
@end

@implementation IsLanTabCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;

}

- (void)awakeFromNib {
    
    [super awakeFromNib];
    
    self.selectionStyle = 0;
    
//    self.title.font = Neuefont(SCREEN_WIDTH*0.04);//Boldfont(SCREEN_WIDTH*0.045);
//    self.areaLab.font = font(SCREEN_WIDTH*0.03);
//    self.describLab.font = font(SCREEN_WIDTH*0.03);
//    
//    self.distansLab.font = self.describLab.font;
    
    self.imgWith.constant = SCREEN_HEIGHT*0.15;
    self.linHight.constant = 0.5;
    
    
    /**
     *  添加 星星评分
     */
    CGFloat hh  = SCREEN_HEIGHT*0.024;
    CGFloat  ww =  (hh*(1.05))*5+(hh/1.5); //1.05是一个星星的宽高比
    CGFloat yy = (SCREEN_HEIGHT*0.13-hh)/2;
    CGFloat xx = self.imgWith.constant+20;
    
    self.starRating = [[TQStarRatingView alloc]initWithFrame:CGRectMake(xx, yy, ww, hh)];
    [self.contentView addSubview:self.starRating];
    
}


-(void)setModel:(Diaochang_listModel *)model{
    _model = model;

    self.title.text = _model.name;
    self.describLab.text = _model.charge;
    self.areaLab.text = _model.location;
    
    self.distansLab.text = [NSString stringWithFormat:@"%@km",_model.distance];
    
    [self.starRating StarForegroundViewWithScore:_model.score];
    
    [self.MainImage sd_setImageWithURL:[NSURL URLWithString:_model.thum]];

    self.detail = _model.detail;
    
    self.latitude = _model.latitude;
    self.longitude = _model.longitude;
    
    self.location = _model.location;
    
    self.Id = _model.tid;
    
    self.height = SCREEN_HEIGHT*0.13;
}

-(void)BottomLineCreat{

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
